package com.custom.lessonstudy.di;

import android.content.Context;

import androidx.fragment.app.Fragment;

/**
 * 基础封装的Fragment
 * @param <V>
 * @param <P>
 */
public abstract class BaseMvpFragment < V extends View, P extends BasePresenter> extends Fragment implements BaseMvp< V, P>{
    protected P presenter;

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);

        presenter = createPresenter();
        if (presenter != null) {
           // presenter.registerModel(createModel());
            presenter.registerView(createView());
        }
    }

    @Override
    public void onDetach() {
        super.onDetach();
        if (presenter != null) {
            presenter.destroy();
        }
    }

}
